<!--
 * @Author: cgl
 * @Date: 2023-04-12 15:25:43
 * @LastEditors: cgl
 * @LastEditTime: 2023-08-16 14:11:10
 * @FilePath: \public-health-emergencies-fed:\radiation-hygiene-fe\src\App.vue
 * @Description:
 *
 * Copyright (c) 2023 by cgl/微盛信息产业有限公司, All Rights Reserved.
-->
<template>
  <div id="app">
    <router-view />
    <theme-picker />
  </div>
</template>

<script>
import ThemePicker from "@/components/ThemePicker";
import { mapGetters } from 'vuex'
import { getWebsiteConfig } from '@/api/system/config'

export default {
  name: "App",
  components: { ThemePicker },
  computed: {
    ...mapGetters(["app_loading"]),
  },
  metaInfo() {
		return {
			// title: this.title || (this.$store.state.settings.dynamicTitle && this.$store.state.settings.title),
      title: this.websiteConfig.sysName,
      link: [
        { rel: 'icon', href: this.websiteConfig.sysIcon + `?t=${Date.now()}` }
      ]
		}
  },
  data() {
    return {
      title: null,
      websiteConfig: {},
    };
  },
  async created() {
    let res = await getWebsiteConfig().catch(err => {})
    this.websiteConfig = res.data || {}
  },
  provide () {
    return{
      getAppLoading: () => this.app_loading,
      websiteConfigFn: () => this.websiteConfig,
    }
  },
  watch: {
    $route: {
      handler(val) {
				// 进入外照射个人监测剂量核查登记表页面
				if (val.path == "/table") {
					this.title = "外照射个人监测剂量核查登记表";
				}else if(val.path == "/handsf") {
					this.title = "手写签名板";
				}
      },
      immediate: true
    },
  },
};
</script>
<style scoped>
#app .theme-picker {
  display: none;
}
</style>
